/* 
 * File:   MyBatchMerge.h
 * Author: Morpheus
 *
 * Created on 20 juin 2013, 16:15
 */

#ifndef MYBATCHMERGE_H
#define	MYBATCHMERGE_H

#include <QtCore/qlist.h>
#include <QtCore/qstring.h>
#include <QtCore/qdatetime.h>
#include "MyBatchUnit.h"

class QDataStream;

class MyBatchMerge {
public:
    MyBatchMerge();
    MyBatchMerge(const MyBatchMerge& orig);
    virtual ~MyBatchMerge();
    
    void detach();
    
    bool removeBatch(const MyBatchUnit&);
    bool insertBatch(const MyBatchUnit&, const int& i = -1);
    bool swapBatch(int , int);
    QList<MyBatchUnit> getBatchList() const;
    void setBatchList(const QList<MyBatchUnit>& );
    
    int getUUID() const;
    void setUUID(const int&);

    QString getName() const;
    void setName(const QString& name);

    QString getSaveFile() const;
    bool isSaveFileOk() const;

    QString getSaveFilePatern() const;
    void setSaveFilePatern(const QString& saveFilePatern);
    
    QString getSaveFileFormat() const;
    void setSaveFileFormat(const QString& saveFileFormat);

    bool getDoWithSuccess() const;
    void setDoWithSuccess(const bool& b);

    QDateTime getCreatedDate() const;
    void setCreatedDate(const QDateTime&);

    QDateTime getLastModifiedDate() const;
    void setLastModifiedDate(const QDateTime&);
    
    bool isBlockUpdate() const;

    void setBlockUpdate(const bool& blockUpdate);
    
    QString interpretPatern(const QString& patern, bool& bOk);
    
    static const int version;
    
private:
    void updateSaveFile();
    QString interpretFunc(const QString& patern, bool& bOk);
    
    QList<MyBatchUnit> m_batchList;
    int m_id;
    QDateTime m_created;
    QDateTime m_lastModified;
    QString m_name;
    QString m_saveFilePatern;
    QString m_saveFileFormat;
    QString m_saveFile;
    bool m_saveFileOk;
    bool m_blockUpdate;
    bool m_doWthSucces;
};

QDataStream& operator<<(QDataStream& , const MyBatchMerge&);
QDataStream& operator>>(QDataStream& , MyBatchMerge&);

#endif	/* MYBATCHMERGE_H */

